﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Exceptionless;
using Microsoft.AspNetCore.Mvc;

namespace Finbook.Api.Controllers
{
    [Route("api/[controller]")]
    public class ValuesController : Controller
    {
        // GET api/values
        [HttpGet]
        public IEnumerable<string> Get()
        {
            ExceptionlessClient.Default.SubmitLog("This is my first exceptionless log.");

            ExceptionlessClient.Default.SubmitEvent(new Exceptionless.Models.Event()
            {
                Message = "This is my first event exceptionless log.",
                Count = 1,
                Source = "gainorloss",
                Type = nameof(ValuesController)
            });
            ExceptionlessClient.Default.SubmitException(new Exception("Id is not allowed zero."));
            ExceptionlessClient.Default.SubmitNotFound("gainorloss");
            ExceptionlessClient.Default.SubmitUnhandledException(new Exception("This exception is not handled."));
            return new string[] { "value1", "value2" };
        }

        // GET api/values/5
        [HttpGet("{id}")]
        public Task<string> Get(int id)
        {
            return Task.FromResult("http://localhost:5000");
        }

        // POST api/values
        [HttpPost]
        public void Post([FromBody]string value)
        {
        }

        // PUT api/values/5
        [HttpPut("{id}")]
        public void Put(int id, [FromBody]string value)
        {
        }

        // DELETE api/values/5
        [HttpDelete("{id}")]
        public void Delete(int id)
        {
        }
    }
}
